import { Router } from 'express'
import * as workflowController from '../controllers/workflow'
import { auth } from '../middleware/auth'

const router = Router()

// 获取工作流列表
router.get('/', auth, workflowController.getWorkflows)

// 获取工作流详情
router.get('/:id', auth, workflowController.getWorkflow)

// 获取工作流模板
router.get('/:id/template', auth, workflowController.getWorkflowTemplate)

// 创建工作流
router.post('/', auth, workflowController.createWorkflow)

// 更新工作流
router.put('/:id', auth, workflowController.updateWorkflow)

// 删除工作流
router.delete('/:id', auth, workflowController.deleteWorkflow)

// 执行工作流
router.post('/:id/execute', auth, workflowController.executeWorkflow)

// 获取执行历史
router.get('/:id/executions', auth, workflowController.getExecutionHistory)

// 获取执行状态
router.get('/executions/:executionId', auth, workflowController.getExecutionStatus)

export default router 